<?php
class content {
	private $id;
	private $url_rewrite;
	private $title;
	private $content;
	private $date;
	private $status;
	// set get id
	public function setid($id) {
		$this->id = $id;
	}
	public function getid() {
		return $this->id;
	}
	// set get url_rewrite
	public function seturl_rewrite($url_rewrite) {
		$this->url_rewrite = $url_rewrite;
	}
	public function geturl_rewrite() {
		return $this->url_rewrite;
	}
	// set get title
	public function settitle($title) {
		$this->title = $title;
	}
	public function gettitle() {
		return $this->title;
	}
	// set get content
	public function setcontent($content) {
		$this->content = $content;
	}
	public function getcontent() {
		return $this->content;
	}
	// set get date
	public function setdate($date) {
		$this->date = $date;
	}
	public function getdate() {
		return $this->date;
	}
	// set get status
	public function setstatus($status) {
		$this->status = $status;
	}
	public function getstatus() {
		return $this->status;
	}
	
	
	public function listall() {
		GLOBAL $db;
		$sql = "SELECT * FROM " . $db->tbl_fix . "content";
		$result = $db->executeQuery ( $sql );
		while ( $rows = mysql_fetch_array ( $result ) ) {
			$return [] = $rows;
		}
		return $return;
	}
	public function getone() {
		GLOBAL $db;
		$sql = "SELECT * FROM " . $db->tbl_fix . "content where id='" . $this->id . "'";
		$return = $db->executeQuery ( $sql, 2 );
		return $return;
	}
	public function update(){
		GLOBAL $db;
		$arr['title'] = $this->gettitle();
		$arr['content'] = $this->getcontent();
		$db->record_update($db->tbl_fix."content", $arr,"`id`='".$this->getid()."'");
	}
	// check login
	public function getabout() {
		Global $db;
		$sql = "select * from " . $db->tbl_fix . "content where `url_rewrite`='gioi-thieu'";
		$rows = $db->executeQuery ( $sql, 2 );
		if (isset ( $rows ))
			return $rows;
	}
}
$content = new content ();
?>